import java.util.Scanner;

public class Day1New {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int l = scanner.nextInt(),r = scanner.nextInt();
        int num = 0;

        for (int i = l; i <= r; i++) {
            int tmp = i;
            while (tmp != 0) {
                if (tmp % 10 == 2) {
                    num++;
                }
                tmp /= 10;
            }
        }
        System.out.println(num);
    }
}
